package org.bsplus.util.aop;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


public class ExceptionLoggingInterceptor implements MethodInterceptor
{
    private Log log = LogFactory.getLog(getClass());

    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable
    {
        try
        {
            return invocation.proceed();
        }
        catch(Throwable t)
        {
            log.warn(t, t);
            throw t;
        }
    }

}
